<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 17-2-17
 * Time: 下午8:49
 */



include "db.php";
$redis = new Redis();
$redis->connect("localhost",6379);
$ping = $redis->ping();
echo $ping;



$keys = $redis->keys("*");
$result = null;
foreach ($keys as $key){
    $result[] = unserialize($redis->get($key));
}
$db = db::getInstance();
if($result == null){
    $result = $db->select("test.student");
    foreach ($result as $key => $val){
        $redis->set($key,serialize($val));
    }
}
//var_dump($redis->keys("*"));
var_dump($result);